package com.qf.service.impl;

import com.qf.dto.ProductTypeDTO;
import com.qf.entity.TProductType;
import com.qf.mapper.TProductTypeMapper;
import com.qf.service.IProductTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiuLiang
 * @Date 2020/3/9
 */
@Service
public class ProductTypeServiceImpl implements IProductTypeService{

    @Autowired
    private TProductTypeMapper productTypeMapper;

    @Override
    public List<ProductTypeDTO> selectAll() {
        List<TProductType> tList = productTypeMapper.selectAll();
        List<ProductTypeDTO> pList = new ArrayList<>();
        for (TProductType t:tList){
            ProductTypeDTO p = new ProductTypeDTO();
            BeanUtils.copyProperties(t,p);
            pList.add(p);
        }
        return pList;
    }
}
